/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package xilinx;
import java.awt.Component;
import java.awt.FlowLayout;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;

import javax.swing.JComboBox;
import javax.swing.JFrame;
import javax.swing.JList;
import javax.swing.UIManager;
import javax.swing.plaf.basic.BasicComboBoxRenderer;
import java.awt.Component;
import javax.swing.JList;
import javax.swing.plaf.basic.BasicComboBoxRenderer;

/**
 *
 * @author dani
 */

public   class MyComboBoxRenderer extends BasicComboBoxRenderer {
  //  String[] tooltips;
    String[] tooltips = { "Interconexión general ", "Redondeo de PCIN(Redondeo hacía infinito) ", 
    "add / sub / acc (operación en paralelo) ", "Redondeo de PCIN(Redondeo a cero)",
    "add / sub / acc (operación secuencial a través de retroalimentación interna)",
    "Redondeo de P(Redondeo hacía infinito)", "Redondeo de A x B",
    "Redondeo de P(Redondeo a cero)"};
    public Component getListCellRendererComponent(JList list, Object value,
        int index, boolean isSelected, boolean cellHasFocus) 
    {
      if (isSelected) 
      {
        setBackground(list.getSelectionBackground());
        setForeground(list.getSelectionForeground());
        if (-1 < index) 
        {
          list.setToolTipText(tooltips[index]);
        }
      } 
      else 
      {
        setBackground(list.getBackground());
        setForeground(list.getForeground());
      }
      setFont(list.getFont());
      setText((value == null) ? "" : value.toString());
      return this;
    }
    
  }   

